package com.zhijian.medical.enums.diagnose.report;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.extern.slf4j.Slf4j;

import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;

/**
 * 报告枚举
 */
@Slf4j
public class ReportEnum {

    /**
     * 术前辅助治疗
     */
    @AllArgsConstructor
    @Getter
    public enum TypeEnum {

        ESOPHAGUS(1, "食管癌"),
        STOMACH(2, "胃癌"),
        RADIOTHERAPY(3, "结直肠癌"),
        COLORECTAL(4, "原发性肝癌"),
        PANCREATICOBILIARY_AMPULLA(5, "胰胆壶腹癌"),
        LUNG(6, "肺癌"),
        BREAST(7, "乳腺癌"),
        NEW_ADJUVANT_BREAST(8, "新辅后乳腺癌"),
        PROSTATE(9, "前列腺癌"),
        BLADDER(10, "膀胱癌"),
        GLIOMA(11, "胶质瘤");

        @Getter
        private final Integer key;
        private final String desc;


        private static final List<MappingEnum<Integer, String>> TEMP_MAPPING = Arrays.stream(TypeEnum.values()).map(e -> new MappingEnum<>(e.getKey(), e.getDesc(), null)).collect(Collectors.toList());


        public static List<MappingEnum<Integer, String>> getList() {
            return TEMP_MAPPING;
        }


        // valueOfKey
        public static TypeEnum valueOfKey(Integer key) {
            return Arrays.stream(TypeEnum.values()).filter(e -> e.getKey().equals(key)).findFirst().orElse(null);
        }

        // valueOfDesc
        public static TypeEnum valueOfDesc(String desc) {
            return Arrays.stream(TypeEnum.values()).filter(e -> e.getDesc().equals(desc)).findFirst().orElse(null);
        }
    }


}
